<template>
  <div>
    <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick">
      <el-tab-pane label="默认设置" name="first">
        <form>
          <fieldset>
            <legend>设置基础信息</legend>
            <input type="checkbox" id="color1" name="color1" value="unExceedPurchasePer" v-model="selectedColors">
            <label for="color1">采购入库数量不允许超过采购量的
              <el-input v-model="inputPercentage" style="width: 40px" />
              %</label><br>
            <input type="checkbox" id="color2" name="color2" value="areaProductZero" v-model="selectedColors">
            <label for="color2">
              <el-select v-model="groupId" style="width: 100px">

                <el-option :label="item.name" :value="item.id" v-for='item in store.sysConfigGetWarehouseAreaListTable'
                  :key='item.id' />
              </el-select>库位数量为0后,
              <el-input v-model="clearLocationProductDays" style="width: 40px" />天清除库位与商品的关联关系</label><br>
            <input type="checkbox" id="color3" name="color3" value="outWarehousePayHoursLater" v-model="selectedColors">
            <label for="color3">付款时间超过
              <el-input v-model="outWarehousePayHoursLater" style="width: 40px" />小时后，未打印出库单的订单弹窗提醒，
              接收提醒的用户角色是 <el-select v-model="outWarehouseUnPrintReceiveRole" style="width: 100px">

                <el-option :label="item.name" :value="item.id" v-for='item in dataTable' :key='item.id' />
              </el-select></label><br>
            <input type="checkbox" id="color4" name="color4" value="printOutWarehouseHoursLater"
              v-model="selectedColors">
            <label for="color4">打印出库单后，超过<el-input v-model="printOutWarehouseHoursLater"
                style="width: 40px" />小时后，未获取运单号弹窗提醒，接收提醒的用户角色是<el-select
                v-model="printOutWarehouseUnOrderNumReceiveRole" style="width: 100px">

                <el-option :label="item.name" :value="item.id" v-for='item in dataTable' :key='item.id' />
              </el-select></label><br>
            <input type="checkbox" id="color4" name="color4" value="recentSaleDays" v-model="selectedColors">
            <label for="color4">最近销量是按最近 <el-input v-model="recentSaleDays" style="width: 40px" />天的销售数量， <label>
                <input type="radio" v-model="isMinusAfterNum" value="1">
                减
              </label>
              <label>
                <input type="radio" v-model="isMinusAfterNum" value="2">
                不减
              </label>
              售后的数量</label><br>
            <input type="checkbox" id="color4" name="color4" value="haveMostChildOrderNum" v-model="selectedColors">
            <label for="color4">一个拣货单最多可以有
              <el-input v-model.number="haveMostChildOrderNum" style="width: 40px" />个子订单</label><br>
            <input type="checkbox" id="color4" name="color4" value="whenLockInventory" v-model="selectedColors">
            <label for="color4">库存将由<el-select v-model="whenLockInventory" style="width: 100px">
                <el-option label="订单进入" value="1" />
                <el-option label="订单审核通过" value="2" />
              </el-select>时进行锁定</label><br>
            <input type="checkbox" id="color4" name="color4" value="warningPositionRetentionDays"
              v-model="selectedColors">
            <label for="color4">采购品留仓<el-input v-model.number="warningPositionRetentionDays"
                style="width: 40px" />天预警发起退货</label><br>
          </fieldset>

          <el-button type="submit" @click="submitForm" style="margin: 30px 80px;">保存</el-button>
        </form>
      </el-tab-pane>
      <el-tab-pane label="打印机管理" name="second">
        <template #label>
          <span class="custom-tabs-label">
            <el-select v-model="valueName" size="large" suffix-icon="" style="width: 100px;margin-top: 2px;"
              @click="activeName = 'second'" @change="activeName = 'second'" class="a">
              <el-option label="快递打印机" value="快递打印机" />
              <el-option label="发货单打印机" value="发货单打印机" />
              <el-option label="拣货单打印机" value="拣货单打印机" />
              <el-option label="出库单打印机" value="出库单打印机" />
              <el-option label="盘货单打印机" value="盘货单打印机" />
              <el-option label="库位条形码" value="库位条形码" />
              <el-option label="入库单打印机" value="入库单打印机" />
            </el-select>
          </span>
        </template>
        <div v-if="valueName == '快递打印机'">
          <!-- 打印机管理 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="订单平台:">
              <el-select v-model="printerForm.orderPT">
                <el-option label="天猫" value="天猫" />
                <el-option label="1688" value="1688" />
                <el-option label="PDD" value="PDD" />
              </el-select>
            </el-form-item>
            <el-form-item label="选择快递:">
              <el-select v-model="printerForm.expresList">
                <el-option label="中通快递" value="中通快递" />
                <el-option label="韵达快递" value="韵达快递" />
              </el-select>
            </el-form-item>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmit">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table ref="multipleTableRef" :data="PrinterSetList" style="width: 100%">
            <el-table-column type="selection" width="55" />
            <el-table-column label="订单平台" width="120">
              <template #default="scope">{{ scope.row.orderPT }}</template>
            </el-table-column>
            <el-table-column label="快递" width="120">
              <template #default="scope">{{ scope.row.expresList }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <!-- <el-button link type="primary" size="small" @click.prevent="deleteRow(scope.row)">
                  编辑
                </el-button> -->
                <el-button link type="primary" size="small" @click.prevent="deleteRow(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="valueName == '库位条形码'">
          <!-- 库位条形码 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmitKW">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="PrinterSetListKW" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column label="打印类型" width="120">
              <template #default="scope">{{ scope.row.typeName }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <!-- <el-button link type="primary" size="small" @click.prevent="deleteRow(scope.row)">
                  编辑
                </el-button> -->
                <el-button link type="primary" size="small" @click.prevent="deleteRowKw(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="valueName == '入库单打印机'">
          <!-- 入库单打印机 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmitRK">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="PrinterSetListRK" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column label="打印类型" width="120">
              <template #default="scope">{{ scope.row.typeName }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <!-- <el-button link type="primary" size="small" @click.prevent="deleteRow(scope.row)">
                  编辑
                </el-button> -->
                <el-button link type="primary" size="small" @click.prevent="deleteRowRK(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="valueName == '发货单打印机'">
          <!-- 发货单打印机 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmitFH">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="PrinterSetListFH" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column label="打印类型" width="120">
              <template #default="scope">{{ scope.row.typeName }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <el-button link type="primary" size="small" @click.prevent="deleteRowFH(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="valueName == '拣货单打印机'">
          <!-- 拣货单打印机 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmitJH">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="PrinterSetListJH" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column label="打印类型" width="120">
              <template #default="scope">{{ scope.row.typeName }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <el-button link type="primary" size="small" @click.prevent="deleteRowJH(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="valueName == '出库单打印机'">
          <!-- 出库单打印机 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmitCK">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="PrinterSetListCK" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column label="打印类型" width="120">
              <template #default="scope">{{ scope.row.typeName }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <el-button link type="primary" size="small" @click.prevent="deleteRowCK(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="valueName == '盘货单打印机'">
          <!-- 盘货单打印机 -->
          <el-form :model="printerForm" inline>
            <el-form-item label="对应的打印机:">
              <el-select v-model="printerForm.PrinterList" @change="getJi">
                <el-option :label="item.name" :value="item.name" v-for="(item, index) in printListNow.printers"
                  :key="index" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmitPH">保存</el-button>
            </el-form-item>
          </el-form>
          <el-table :data="PrinterSetListPH" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column label="打印类型" width="120">
              <template #default="scope">{{ scope.row.typeName }}</template>
            </el-table-column>
            <el-table-column label="打印机" width="300">
              <template #default="scope">{{ scope.row.PrinterList }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120">
              <template #default="scope">
                <el-button link type="primary" size="small" @click.prevent="deleteRowPH(scope.$index)">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-tab-pane>
      <el-tab-pane label="打印单模板" name="third"></el-tab-pane>
      <el-tab-pane label="耗材管理" name="fourth"></el-tab-pane>
    </el-tabs>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useAlertsStore } from '@/store/index'
import { sysConfigcreateUpdate, sysUserGrouplist, sysConfigconfigKeyValueMap } from '@/api/index'
import { ElMessage } from 'element-plus'
const store = useAlertsStore()
const printListNow = ref('')
const valueName = ref('快递打印机')
onMounted(() => {
  getListFenzu()
  store.sysConfigGetWarehouseAreaListBtn()
  sysConfigconfigKeyValueMapBtn()
  doConnect()
  if (localStorage.getItem('printerproperties')) {
    const a = localStorage.getItem('printerproperties')
    printListNow.value = JSON.parse(a).printers
  }
  if (localStorage.getItem('PrinterSetList')) {
    const b = localStorage.getItem('PrinterSetList')
    PrinterSetList.value = JSON.parse(b)
  }
  if (localStorage.getItem('PrinterSetListKW')) {
    const b = localStorage.getItem('PrinterSetListKW')
    PrinterSetListKW.value = JSON.parse(b)
  }
  if (localStorage.getItem('PrinterSetListFH')) {
    const b = localStorage.getItem('PrinterSetListFH')
    PrinterSetListFH.value = JSON.parse(b)
  }
  if (localStorage.getItem('PrinterSetListJH')) {
    const b = localStorage.getItem('PrinterSetListJH')
    PrinterSetListJH.value = JSON.parse(b)
  }
  if (localStorage.getItem('PrinterSetListCK')) {
    const b = localStorage.getItem('PrinterSetListCK')
    PrinterSetListCK.value = JSON.parse(b)
  }
  if (localStorage.getItem('PrinterSetListPH')) {
    const b = localStorage.getItem('PrinterSetListPH')
    PrinterSetListPH.value = JSON.parse(b)
  }
  if (localStorage.getItem('PrinterSetListRK')) {
    const b = localStorage.getItem('PrinterSetListRK')
    PrinterSetListRK.value = JSON.parse(b)
  }
})
const getJi = () => {
  store.socket.send(JSON.stringify({
    cmd: 'getPrinters',
    requestID: '123458976',
    version: '1.0'
  }))
}
// 打印机
// const PrinterList = ref([])
const PrinterSetList = ref([])
const printerForm = ref({})
const activeName = ref('first')
const handleClick = (tab, event) => {
  console.log(tab.props)
  activeName.value = tab.props.name
  if (activeName.value === 'first') {
    getListFenzu()
    // sysConfigconfigKeyValueMapBtn()
    if (localStorage.getItem('printerproperties')) {
      const a = localStorage.getItem('printerproperties')
      printListNow.value = JSON.parse(a).printers
    }
    if (localStorage.getItem('PrinterSetList')) {
      const b = localStorage.getItem('PrinterSetList')
      PrinterSetList.value = JSON.parse(b)
    }
    if (localStorage.getItem('PrinterSetListKW')) {
      const b = localStorage.getItem('PrinterSetListKW')
      PrinterSetListKW.value = JSON.parse(b)
    }
    if (localStorage.getItem('PrinterSetListFH')) {
      const b = localStorage.getItem('PrinterSetListFH')
      PrinterSetListFH.value = JSON.parse(b)
    }
    if (localStorage.getItem('PrinterSetListJH')) {
      const b = localStorage.getItem('PrinterSetListJH')
      PrinterSetListJH.value = JSON.parse(b)
    }
    if (localStorage.getItem('PrinterSetListCK')) {
      const b = localStorage.getItem('PrinterSetListCK')
      PrinterSetListCK.value = JSON.parse(b)
    }
    if (localStorage.getItem('PrinterSetListPH')) {
      const b = localStorage.getItem('PrinterSetListPH')
      PrinterSetListPH.value = JSON.parse(b)
    }
    if (localStorage.getItem('PrinterSetListRK')) {
      const b = localStorage.getItem('PrinterSetListRK')
      PrinterSetListRK.value = JSON.parse(b)
    }
  }
}
const deleteRow = (row) => {
  console.log(row)
  PrinterSetList.value.splice(row, 1)
  localStorage.setItem('PrinterSetList', JSON.stringify(PrinterSetList.value))
}
const onSubmit = () => {
  // const a = []
  PrinterSetList.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetList', JSON.stringify(PrinterSetList.value))
}
const doConnect = () => {
  console.log('d打开了不')
  store.socket = new WebSocket('ws://localhost:13528')
  // 打开Socket
  store.socket.onopen = function (event) {
    // console.log(event)
    // 监听消息
    store.socket.onmessage = function (event) {
      console.log('1111')

      printListNow.value = JSON.parse(event.data)
      console.log(event)
      localStorage.setItem('printerproperties', event.data)
    }
    // 监听Socket的关闭
    store.socket.onclose = function (event) {
      console.log('Client notified socket has closed', event)
    }
    store.socket.send(JSON.stringify({
      cmd: 'getPrinters',
      requestID: '123458976',
      version: '1.0'
    }))
  }
}
const PrinterSetListKW = ref([])
const onSubmitKW = () => {
  // const a = []
  PrinterSetListKW.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetListKW', JSON.stringify(PrinterSetListKW.value))
}
const deleteRowKw = (row) => {
  console.log(row)
  PrinterSetListKW.value.splice(row, 1)
  localStorage.setItem('PrinterSetListKW', JSON.stringify(PrinterSetListKW.value))
}
const PrinterSetListFH = ref([])
const onSubmitFH = () => {
  // const a = []
  PrinterSetListFH.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetListFH', JSON.stringify(PrinterSetListFH.value))
}
const deleteRowFH = (row) => {
  console.log(row)
  PrinterSetListFH.value.splice(row, 1)
  localStorage.setItem('PrinterSetListFH', JSON.stringify(PrinterSetListFH.value))
}
const PrinterSetListJH = ref([])
const onSubmitJH = () => {
  // const a = []
  PrinterSetListJH.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetListJH', JSON.stringify(PrinterSetListJH.value))
}
const deleteRowJH = (row) => {
  console.log(row)
  PrinterSetListJH.value.splice(row, 1)
  localStorage.setItem('PrinterSetListJH', JSON.stringify(PrinterSetListJH.value))
}
const PrinterSetListCK = ref([])
const onSubmitCK = () => {
  // const a = []
  PrinterSetListCK.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetListCK', JSON.stringify(PrinterSetListCK.value))
}
const deleteRowCK = (row) => {
  console.log(row)
  PrinterSetListCK.value.splice(row, 1)
  localStorage.setItem('PrinterSetListCK', JSON.stringify(PrinterSetListCK.value))
}
const PrinterSetListPH = ref([])
const onSubmitPH = () => {
  // const a = []
  PrinterSetListPH.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetListPH', JSON.stringify(PrinterSetListPH.value))
}
const deleteRowPH = (row) => {
  console.log(row)
  PrinterSetListPH.value.splice(row, 1)
  localStorage.setItem('PrinterSetListPH', JSON.stringify(PrinterSetListPH.value))
}
// 入库
const PrinterSetListRK = ref([])
const onSubmitRK = () => {
  // const a = []
  PrinterSetListRK.value.push(Object.assign({}, printerForm.value, { typeName: valueName.value }))
  // = a
  localStorage.setItem('PrinterSetListRK', JSON.stringify(PrinterSetListRK.value))
}
const deleteRowRK = (row) => {
  console.log(row)
  PrinterSetListRK.value.splice(row, 1)
  localStorage.setItem('PrinterSetListRK', JSON.stringify(PrinterSetListRK.value))
}

// 基础设置
const selectedColors = ref([])
const sysConfigListDTO = ref([])
const submitForm = () => {
  console.log('selectedColors.value')
  console.log(selectedColors.value)
  sysConfigListDTO.value = []
  if (selectedColors.value.includes('unExceedPurchasePer')) {
    const a = {
      umsMenuId: 1,
      configKey: 'unExceedPurchasePer',
      configValue: inputPercentage.value
    }
    sysConfigListDTO.value.push(a)
  }
  if (selectedColors.value.includes('areaProductZero')) {
    const a = {
      umsMenuId: 1,
      configKey: 'areaProductZero',
      configValue: groupId.value
    }
    const b = {
      umsMenuId: 1,
      configKey: 'clearLocationProductDays',
      configValue: clearLocationProductDays.value
    }
    sysConfigListDTO.value.push(a)
    sysConfigListDTO.value.push(b)
  }
  if (selectedColors.value.includes('outWarehousePayHoursLater')) {
    const a = {
      umsMenuId: 1,
      configKey: 'outWarehousePayHoursLater',
      configValue: outWarehousePayHoursLater.value
    }
    const b = {
      umsMenuId: 1,
      configKey: 'outWarehouseUnPrintReceiveRole',
      configValue: outWarehouseUnPrintReceiveRole.value
    }
    sysConfigListDTO.value.push(a)
    sysConfigListDTO.value.push(b)
  }
  if (selectedColors.value.includes('printOutWarehouseHoursLater')) {
    const a = {
      umsMenuId: 1,
      configKey: 'printOutWarehouseHoursLater',
      configValue: printOutWarehouseHoursLater.value
    }
    const b = {
      umsMenuId: 1,
      configKey: 'printOutWarehouseUnOrderNumReceiveRole',
      configValue: printOutWarehouseUnOrderNumReceiveRole.value
    }
    sysConfigListDTO.value.push(a)
    sysConfigListDTO.value.push(b)
  }
  if (selectedColors.value.includes('recentSaleDays')) {
    const a = {
      umsMenuId: 1,
      configKey: 'recentSaleDays',
      configValue: recentSaleDays.value
    }
    const b = {
      umsMenuId: 1,
      configKey: 'isMinusAfterNum',
      configValue: isMinusAfterNum.value
    }
    sysConfigListDTO.value.push(a)
    sysConfigListDTO.value.push(b)
  }
  if (selectedColors.value.includes('haveMostChildOrderNum')) {
    const a = {
      umsMenuId: 1,
      configKey: 'haveMostChildOrderNum',
      configValue: haveMostChildOrderNum.value
    }
    sysConfigListDTO.value.push(a)
  }
  if (selectedColors.value.includes('whenLockInventory')) {
    const a = {
      umsMenuId: 1,
      configKey: 'whenLockInventory',
      configValue: whenLockInventory.value
    }
    sysConfigListDTO.value.push(a)
  }
  if (selectedColors.value.includes('warningPositionRetentionDays')) {
    const a = {
      umsMenuId: 1,
      configKey: 'warningPositionRetentionDays',
      configValue: warningPositionRetentionDays.value
    }
    sysConfigListDTO.value.push(a)
  }

  sysConfigcreateUpdate({
    sysConfigListDTO: sysConfigListDTO.value
  }).then(res => {
    ElMessage.success('操作成功')
    sysConfigconfigKeyValueMapBtn()
  })
}
const whenLockInventory = ref('')
const warningPositionRetentionDays = ref('')
const inputPercentage = ref('')
const recentSaleDays = ref('')
const haveMostChildOrderNum = ref('')
const isMinusAfterNum = ref('')
const clearLocationProductDays = ref('')
const outWarehousePayHoursLater = ref('')
const outWarehouseUnPrintReceiveRole = ref('')
const printOutWarehouseHoursLater = ref('')
const printOutWarehouseUnOrderNumReceiveRole = ref('')
const dataTable = ref([])
const groupId = ref('')
const getListFenzu = () => {
  sysUserGrouplist().then(res => {
    const { data: { data } } = res
    dataTable.value = data
  })
}
const a = ref({

})
const sysConfigconfigKeyValueMapBtn = () => {
  sysConfigconfigKeyValueMap(1).then(res => {
    console.log('res')
    const { data: { data } } = res
    a.value = data
    console.log('unExceedPurchasePer' in data)
    if ('unExceedPurchasePer' in data) {
      inputPercentage.value = data.unExceedPurchasePer
    }
    if ('areaProductZero' in data) {
      groupId.value = data.areaProductZero
      clearLocationProductDays.value = data.clearLocationProductDays
    }
    if ('outWarehousePayHoursLater' in data) {
      outWarehousePayHoursLater.value = data.outWarehousePayHoursLater
      outWarehouseUnPrintReceiveRole.value = data.outWarehouseUnPrintReceiveRole
    }
    if ('printOutWarehouseHoursLater' in data) {
      printOutWarehouseHoursLater.value = data.printOutWarehouseHoursLater
      printOutWarehouseUnOrderNumReceiveRole.value = data.printOutWarehouseUnOrderNumReceiveRole
    }
    if ('recentSaleDays' in data) {
      recentSaleDays.value = data.recentSaleDays
      isMinusAfterNum.value = data.isMinusAfterNum
    }
    if ('haveMostChildOrderNum' in data) {
      haveMostChildOrderNum.value = data.haveMostChildOrderNum
    }
    if ('whenLockInventory' in data) {
      whenLockInventory.value = data.whenLockInventory
    }
    if ('warningPositionRetentionDays' in data) {
      warningPositionRetentionDays.value = data.warningPositionRetentionDays
    }
  })
}
</script>

<style lang='less' scoped>
::v-deep .el-input__inner {
  border: none;
  box-shadow: none;
}

/* 去除边框 */
// :deep(.el-select .el-input__wrapper) {
//   box-shadow: none !important;
// }

// /* 去除选中时蓝色边框（下面两个都要加上） */
// :deep(.el-input .el-input__wrapper.is-focus) b {
//   box-shadow: none !important;
// }

:deep a {
  border-color: #DCDFE6 !important;
  box-shadow: none !important;
}
</style>
